<!DOCTYPE html>
<html>
    <!-- Cabecera del html -->
    <head>
        <meta http-equiv="content-type" content="text/html" />
        <meta charset="UTF-8" />
        <link rel="icon" type="image/png" href="img/jartibles_logo.png" />
        <title>Alta Socio - JCC</title>
        <!-- CSS -->
        <link href="css/global.css" rel="stylesheet" type="text/css" />
        <!-- JS -->
        <script type="text/javascript" src="js/libreria_jquery.js"></script>
        <script type="text/javascript" src="js/global.js"></script>
        <script type="text/javascript" src="js/ajax.js"></script>
    </head>

    <!-- Cuerpo del html -->
    <body>
        <?php
        session_start();
        if (!isset($_SESSION['usuario'])) {
            header("Location: index.php");
        }
        ?>
        <div id="wrap">
            <div id="header">

            </div>
            <div id="main" class="clearfix">
                <div id="nav">

                </div>
                <div id="content">
                    <div id="contenedor_registro">
                        <div><h2>Alta de Socios</h2></div>
                        <form name="formulario" action="modules/registrar/validar_registrar.php" method="POST">
                            <fieldset>
                                <center>
                                    <table id="registrarse">
                                        <tr>
                                            <td>Nick:</td> 
                                            <td><input type="text" name="nick" size="20" maxlength="10" required></td>
                                        </tr>
                                        <tr>
                                            <td>Contraseña:</td> 
                                            <td><input type="password" name="password" size="20" maxlength="10" required></td>
                                        </tr>
                                        <tr>
                                            <td>Rango:</td> 
                                            <td>
                                                <?php
                                                include_once '/modules/bd/bd.php';
                                                $conexion = conectarBD();
                                                //Consultamos en la base de datos.
                                                $tabla = 'rango';
                                                $sql = "SELECT id_rango, categoria FROM $tabla";
                                                $resultado = mysql_query($sql, $conexion);
                                                $menu = "<select name='rango' id='rango' required>\n<option selected value='0'>Elige una opción...</option>";
                                                while ($dato = mysql_fetch_array($resultado)) {
                                                    if ($dato[0] != '1') {
                                                        $menu.="\n<option value='" . $dato[0] . "'>" . $dato[1] . "</option>";
                                                    }
                                                }
                                                $menu.="\n</select>";
                                                mysql_free_result($resultado); //Liberamos memoria borrando el resultado                                                
                                                echo $menu;
                                                ?>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td><br/></td> 
                                            <td><br/></td>
                                        </tr>
                                        <tr>
                                            <td>Nombre:</td> 
                                            <td><input type="text" id="nombre" name="nombre" size="20" maxlength="20" required></td>
                                        </tr>
                                        <tr>
                                            <td>Apellidos:</td> 
                                            <td><input type="text" name="apellidos" size="20" maxlength="50" required></td>
                                        </tr>									
                                        <tr>
                                            <td>DNI:</td> 
                                            <td><input type="text" name="dni" size="20" maxlength="9" required></td>
                                        </tr>
                                        <tr>
                                            <td>Teléfono:</td> 
                                            <td><input type="text" name="telefono" size="20" maxlength=9 required></td>
                                        </tr>
                                        <tr>
                                            <td>Email:</td> 
                                            <td><input type="email" name="mail" size="20" maxlength="100" required></td>
                                        </tr>
                                        <tr>
                                            <td><br/></td> 
                                            <td><br/></td>
                                        </tr>
                                        <tr>
                                            <td>Pais:</td> 
                                            <td>
                                                <?php
                                                ;
                                                //Consultamos en la base de datos.
                                                $tabla = 'pais';
                                                $sql = "SELECT id_pais, nombre FROM $tabla";
                                                $resultado = mysql_query($sql, $conexion);
                                                $menu2 = "<select name='pais' id='pais' required>\n<option selected value='0'>Elige una opción...</option>";
                                                while ($dato = mysql_fetch_array($resultado)) {
                                                    $menu2.="\n<option value='" . $dato[0] . "'>" . utf8_encode($dato[1]) . "</option>";
                                                }
                                                $menu2.="\n</select>";
                                                mysql_free_result($resultado); //Liberamos memoria borrando el resultado
                                                mysql_close($conexion); //Cerramos la conexión con el servidor
                                                echo $menu2;
                                                ?>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>C. Autonoma:</td> 
                                            <td>
                                                <select name="cautonoma" id="cautonoma" disabled>
                                                    <option selected value="0">Elige una opción...</option>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Provincia:</td> 
                                            <td>
                                                <select name="provincia" id="provincia" disabled="true">
                                                    <option selected value="0">Elige una opción...</option>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Poblacion:</td> 
                                            <td>
                                                <select name="poblacion" id="poblacion" disabled="true">
                                                    <option selected value="0">Elige una opción...</option>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Calle:</td> 
                                            <td><input type="text" name="calle" size="20" maxlength="50" required></td>
                                        </tr>
                                        <tr>
                                            <td>Número:</td> 
                                            <td><input type="text" name="numero" size="20" maxlength="50" required></td>
                                        </tr>
                                        <tr>
                                            <td><br/></td> 
                                            <td><br/></td>
                                        </tr>
                                        <tr>
                                            <td>Marca:</td> 
                                            <td><input type="text" name="marca" size="20" maxlength="50" required></td>
                                        </tr>
                                        <tr>
                                            <td>Modelo:</td> 
                                            <td><input type="text" name="modelo" size="20" maxlength="50" required></td>
                                        </tr>
                                        <tr>
                                            <td>Color:</td> 
                                            <td><input type="text" name="color" size="20" maxlength="50" required></td>
                                        </tr>
                                        <tr>
                                            <td>Año:</td> 
                                            <td><input type="text" name="anio" size="20" maxlength="50" required></td>
                                        </tr>
                                        <tr>
                                            <td><br/></td> 
                                            <td><br/></td>
                                        </tr>
                                        <tr>
                                            <td><input type="submit" value="Guardar"></td> 
                                            <td><input type="reset" value="Limpiar datos"></td>
                                        </tr>                                    
                                    </table>
                                </center>
                            </fieldset>
                        </form>                        
                    </div>
                </div>
            </div>
        </div>
        <div id="footer">

        </div>
    </body>
</html>